import {
  Component,
  ChangeDetectionStrategy,
  ViewEncapsulation,
  Input,
  forwardRef,
} from '@angular/core'
import { AdTreeData } from './tree.interface'

export abstract class AdTreeNodeProviderClass {
  adTreeData: AdTreeData
}

@Component({
  selector: 'ad-tree-node-provider',
  template: `<ng-content></ng-content>`,
  changeDetection: ChangeDetectionStrategy.OnPush,
  encapsulation: ViewEncapsulation.None,
  providers: [
    { provide: AdTreeNodeProviderClass, useExisting: forwardRef(() => AdTreeNodeProvider) },
  ],
  host: {
    '[class.ad-tree-node-provider]': 'true',
  },
})
export class AdTreeNodeProvider {
  @Input() adTreeData: AdTreeData
}
